﻿<UserControl x:Class="Lardite.RefAssistant.UI.View.SolutionReferencesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:app="clr-namespace:Lardite.RefAssistant"
             xmlns:ui="clr-namespace:Lardite.RefAssistant.UI"
             xmlns:vm="clr-namespace:Lardite.RefAssistant.UI.ViewModel"
             xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        
        <ResourceDictionary>

            <ui:ImageManager x:Key="ImageManager" />

            <HierarchicalDataTemplate DataType="{x:Type vm:ProjectData}" 
                                      ItemsSource="{Binding Path=References,Mode=OneWay}">
                <TextBlock Text="{Binding Project.Name}" FontWeight="Bold" />
            </HierarchicalDataTemplate>

            <DataTemplate DataType="{x:Type vm:ReferenceData}" >                
                <StackPanel Margin="1"
                            FlowDirection="LeftToRight" Orientation="Horizontal" 
                            CanHorizontallyScroll="False" CanVerticallyScroll="False">                    
                    <CheckBox IsChecked="{Binding IsUnused}" ToolTip="{x:Static app:Resources.UI_UnusedReferencesWindow_CheckReference_ToolTip}"/>
                    <Image Margin="3,0,2,0" Source="{Binding AssemblyImage, Mode=OneTime, Source={StaticResource ImageManager}}" />
                    <TextBlock Text="{Binding AssemblyName}" ToolTip="{Binding AssemblyFullName}"  
                               HorizontalAlignment="Stretch"/>
                </StackPanel>
            </DataTemplate>

            <Style TargetType="{x:Type TreeView}">
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="ItemContainerStyle">
                    <Setter.Value>
                        <Style TargetType="TreeViewItem">
                            <Setter Property="TreeViewItem.IsExpanded" Value="True"/>
                        </Style>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <TreeView ItemsSource="{Binding Projects}" />
    </Grid>
</UserControl>
